//
//  ViewController.swift
//  MoveOptions
//
//  Created by zhengju on 2017/8/1.
//  Copyright © 2017年 zhengju. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    
   var selectedOptions = [ZJMoveOptionsModel]()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white
        
        let btn = UIButton()
        btn.frame = CGRect.init(x: 0, y: 0, width: 100, height: 30)
        btn.setTitle("请点击跳转", for: .normal)
        btn.backgroundColor = UIColor.blue
        btn.center = self.view.center
        btn.addTarget(self, action: #selector(btnClick(_:)), for: .touchUpInside)
        self.view.addSubview(btn)

        
      let titles   = ["视频","娱乐","财经","北京","科技"]
        
        
        for item in titles {
           let model =  ZJMoveOptionsModel()
            model.initModel(title: item, isLong: true, disPlayDelete: true)
            selectedOptions.append(model)
        }
        
    }
    
     func btnClick(_ button: UIButton) {

        
        let moveOptions = ZJMoveOptions()
        
        moveOptions.saveAction = { (array:Array) in
            
            self.selectedOptions = array
        
        }
        moveOptions.style = .cellLong
        
        var all = [ZJMoveOptionsModel]()
        
        
        let arr = ["图片","军事","体育","汽车","社会","旅游","搞笑","NBA","八卦","时尚","女性","博客","数码","教育","星座"]
        
        for item in arr {
            let model =  ZJMoveOptionsModel()
            model.initModel(title: item, isLong: false, disPlayDelete: false)
            all.append(model)
        }
        
        
        moveOptions.moveOptions = [selectedOptions,all]

        self.navigationController?.pushViewController(moveOptions, animated: true)

    }

}

